Skip to content

Test coverage for API modules#14

Merged
mshriver merged 1 commit intoibutsu:mainfrom
mshriver:unit-test-coverage
Nov 24, 2025
Merged

Test coverage for API modules#14
mshriver merged 1 commit intoibutsu:mainfrom
mshriver:unit-test-coverage

Conversation

@mshriver
Copy link
Contributor

@mshriver mshriver commented Nov 24, 2025

Summary by Sourcery

Tests:

  • Introduce tests for admin project management, user management, import, task, user, widget, and widget configuration API modules.

Copilot AI review requested due to automatic review settings November 24, 2025 18:02
@sourcery-ai
Copy link

sourcery-ai bot commented Nov 24, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds initial Jest test suites for multiple API client modules to improve test coverage and verify basic request behaviors.

File-Level Changes

Change Details Files
Introduce unit tests for admin project management API client behaviors.
  • Add test suite covering core AdminProjectManagementApi methods and their expected HTTP calls
  • Verify request paths, HTTP methods, and required parameters for project management operations
  • Set up any necessary test fixtures or mocks for API client dependencies
src/apis/__tests__/AdminProjectManagementApi.test.ts
Introduce unit tests for admin user management API client behaviors.
  • Add test suite covering core AdminUserManagementApi methods and their expected HTTP calls
  • Verify request paths, HTTP methods, and required parameters for admin user operations
  • Set up mocks/fixtures for HTTP client or configuration used by the API
src/apis/__tests__/AdminUserManagementApi.test.ts
Introduce unit tests for import-related API client behaviors.
  • Add test suite covering ImportApi methods such as starting imports and checking status
  • Validate serialization of payloads and query parameters for import operations
  • Mock network layer to assert correct endpoint usage and options
src/apis/__tests__/ImportApi.test.ts
Introduce unit tests for task-related API client behaviors.
  • Add tests for TaskApi methods that create, fetch, and update tasks
  • Assert correct construction of URLs, HTTP methods, and payloads
  • Cover success and basic error-path behaviors where applicable
src/apis/__tests__/TaskApi.test.ts
Introduce unit tests for end-user-facing API client behaviors.
  • Add test suite for UserApi methods around user retrieval and updates
  • Verify query/body parameter passing and handling of required arguments
  • Mock API transport to avoid real network calls while asserting configuration
src/apis/__tests__/UserApi.test.ts
Introduce unit tests for widget API client behaviors.
  • Add tests for WidgetApi methods related to widget CRUD and retrieval
  • Ensure endpoints, HTTP verbs, and payload shapes are correct
  • Use shared mocks/fixtures where possible to keep tests consistent
src/apis/__tests__/WidgetApi.test.ts
Introduce unit tests for widget configuration API client behaviors.
  • Add tests for WidgetConfigApi methods such as fetching and updating configurations
  • Check that configuration data is correctly sent and parsed in requests/responses
  • Reuse existing mock setup patterns to keep coverage consistent with other APIs
src/apis/__tests__/WidgetConfigApi.test.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.82%. Comparing base (b1014fb) to head (360d40e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main      #14       +/-   ##
===========================================
+ Coverage   60.19%   84.82%   +24.63%     
===========================================
  Files          51       51               
  Lines        2050     2050               
  Branches      524      524               
===========================================
+ Hits         1234     1739      +505     
+ Misses        816      310      -506     
- Partials        0        1        +1     
Flag Coverage Δ
unittests 84.82% <ø> (+24.63%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 20 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1014fb...360d40e. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive test coverage for six API modules in the codebase: WidgetConfigApi, WidgetApi, UserApi, TaskApi, ImportApi, AdminUserManagementApi, and AdminProjectManagementApi. The tests follow established patterns from existing test files and verify API functionality including CRUD operations, error handling, pagination, filtering, and authentication.

  • Adds test coverage for widget configuration and widget type APIs
  • Implements tests for user management, token management, and task tracking APIs
  • Covers admin user and project management endpoints with comprehensive CRUD testing

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/apis/tests/WidgetConfigApi.test.ts Comprehensive tests for widget configuration CRUD operations, pagination, filtering, and authentication
src/apis/tests/WidgetApi.test.ts Tests for widget retrieval and widget type listing with authentication
src/apis/tests/UserApi.test.ts Tests for current user operations and token management with proper JSON serialization
src/apis/tests/TaskApi.test.ts Basic test coverage for task retrieval and error handling
src/apis/tests/ImportApi.test.ts Tests for import file upload and retrieval with FormData handling
src/apis/tests/AdminUserManagementApi.test.ts Admin user CRUD operations with pagination and filtering tests
src/apis/tests/AdminProjectManagementApi.test.ts Admin project CRUD operations with pagination and filtering tests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mshriver mshriver force-pushed the unit-test-coverage branch 2 times, most recently from d51bf3e to 0f9bf22 Compare November 24, 2025 18:32
@mshriver mshriver merged commit fa71793 into ibutsu:main Nov 24, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants